<?php
/**
 * Created by PhpStorm.
 * User: 27642
 * Date: 2017/12/24
 * Time: 18:32
 */
namespace app\api\controller;

use app\api\model\ProductModel;

class Product extends BaseController
{
    /**
     * 根据产品分类id获取产品
     */
    public function getListByCid()
    {
        $cid = input('param.cid');
        if ( empty($cid) ) {
            return wrong_return(-1001,'参数错误');
        }
        $m_article = new ProductModel();
        $list = $m_article->getListByCid($cid);

        return ok_return('200',$list);

    }

    public function getDetail()
    {
        $id = input('param.id');
        $m_product = new ProductModel();
        $detail = $m_product->getDetailById($id);

        return ok_return(200,$detail);


    }
}